package com.zbj;

import org.springframework.context.ApplicationContext;

/**
 * ApplicationContextUtils
 *
 * @author weigang
 * @create 2019-07-31
 **/
public class ApplicationContextUtils {

    private static ApplicationContext applicationContext;

    public static void setApplicationContext(ApplicationContext applicationContext) {
        ApplicationContextUtils.applicationContext = applicationContext;
    }

    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    public static <T> T getBean(Class<T> requiredType) {
        return applicationContext.getBean(requiredType);
    }
}